<%@page import="com.sdry.model.llm.User"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>工位：离心</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<link rel="stylesheet" href="${pageContext.request.contextPath }/assets/css/layui.css"  media="all">
	<link rel="stylesheet" href="${pageContext.request.contextPath }/assets/css/toastr.min.css"  media="all">
	
	<script src="${pageContext.request.contextPath }/assets/layui.js" charset="utf-8"></script>
	<script src="${pageContext.request.contextPath }/assets/layui.all.js"></script>
	<script src="${pageContext.request.contextPath }/assets/js/jquery.min.js" charset="utf-8"></script>
	<script src="${pageContext.request.contextPath }/assets/js/toastr.min.js" charset="utf-8"></script>
    <style type="text/css">
    	.font1 {
    		font-family:微软雅黑;
    		font-size:52px;
    		line-height: 110px;
    		color: #ffffff
    	}
    	.font2 {
    		font-family:微软雅黑;
    		font-size:36px;
    		line-height: 75px;
    		color: #ffffff
    	}
    	.font3 {
    		font-family:微软雅黑;
    		font-size:36px;
    		line-height: 38px;
    	}
    	.font4 {
    		font-family:微软雅黑;
    		font-size:36px;
    		line-height: 141px;
    	}
    	/* 设置表头 */
		#table1 tr .headTd {
			background-color: #0073BD;
			color: #0073BD;
		}
    	.showTable td{
			border-width: 1px;
		    border-style: solid;
		    border-color: #7F7F7F;
		    font-size: 24px;
		    font-family: 微软雅黑
    	}
    	.color3{
    		background-color: #06b0de;
    		color: #ffffff
    	}
    	.color4{
    		background-color: #00B050;
    		color: #ffffff
    	}
    </style>
</head>

<%
	User people = (User) request.getSession().getAttribute("currentUser");
    String name = null;
    String date = null;
    if(people != null){
      name = people.getUserName();
      date = people.getRemark3();
    }
%>

<script type="text/javascript">
	var date = '<%=date%>';
	var position = "组装";
    var planProduct = "planProduct";
    var planNum = "planNum";
    var realityProduct = "realityProduct";
    var realityNum = "realityNum";
    
    var sb = "sb";
    var bxStare = "bxStare";
    var sbN = "sbN";
    var bxNum1 = "bxNum";
    
    var wl = "wl";
    var wlNum = "wlNum";
	//离心机状态定时刷新
	setInterval(function() {dingShiFingNum()},1000*60*0.5);
	//时间
	setInterval(function() {mytime()},1000);
	//时分秒
	function mytime(){
	    var a = new Date();
	    var b = a.toLocaleTimeString('chinese', { hour12: false });
	    document.getElementById("time1").innerHTML = b;
	}
	//年月日+星期
	function load(){
		var d=new Date();
		var day=d.getDate();
		var month=d.getMonth() + 1;
		var year=d.getFullYear();
		var weekday=new Array(7);
		weekday[0]="星期日";
		weekday[1]="星期一";
		weekday[2]="星期二";
		weekday[3]="星期三";
		weekday[4]="星期四";
		weekday[5]="星期五";
		weekday[6]="星期六";
		document.getElementById('myTime').innerHTML = year + "年" + add0(month) + "月" + add0(day)+"日";
		//date = year + "-" + add0(month) + "-" + add0(day);
		document.getElementById('myWeek').innerHTML = weekday[d.getDay()];
	}
	 
	 function add0(m){
	    	return m<10?'0'+m:m 
	 }
	 var productArr = 
			[
				 ["01","PSH2-0960-T-01","热法","0960"]
				 ,["02","PSH2-0980-T-02","热法","0980"]
				 ,["03","PSH1-1060-B-03","湿法","1060"]
				 ,["04","PSH1-1080-C-04","湿法","1080"]
			];
	 var sbArr = ["卷膜","切丝","插管","安装端盖"];
	 var wlArr = ["膜管组合件","膜丝","中心管组合件","封头","环氧胶"];
	//初始化
	$(function() {
		//年月日+星期
		load();
		//时间
		mytime();
		//根据查询
    	selectNum();
    	dingShiFingNum();
	})
    
   	
    
    
	function selectNum() {
	    for (var i = 0; i < productArr.length; i++) {
	    	$("#"+planProduct+(i+1)).html(productArr[i][3]);
	    	$("#"+realityProduct+(i+1)).html(productArr[i][3]);
		}
	    
	    for (var i = 0; i < sbArr.length; i++) {
	    	$("#"+sb+(i+1)).html(sbArr[i]);
	    	$("#"+sbN+(i+1)).html(sbArr[i]);
	    }
	    for (var i = 0; i < wlArr.length; i++) {
		    $("#"+wl+(i+1)).html(wlArr[i]);
	    }
	}
	function dingShiFingNum() {
		var product = "";
	    $("#planNum").html(fingPlanNum(date,product,position)+"支");
	    $("#realityNum").html(fingRealityNum(date,product)+"支");
	    for (var i = 0; i < productArr.length; i++) {
	    	$("#"+planNum+(i+1)).html(fingPlanNum(date,productArr[i][1],position)+"支");
		    $("#"+realityNum+(i+1)).html(fingRealityNum(date,productArr[i][1])+"支");
		}
	    
	    for (var i = 0; i < sbArr.length; i++) {
	    	var arr = fingSbNum(date,sbArr[i])
	    	$("#"+bxStare+(i+1)).html(arr[1]);
	    	$("#"+bxNum1+(i+1)).html(arr[0]+"次");
	    } 
	    for (var i = 0; i < wlArr.length; i++) {
		    $("#"+wlNum+(i+1)).html(fingwlNum(wlArr[i]));
	    }
	}
	function fingSbNum(date,sb) {
		var arr = new Array();
		//计划量
    	$.ajax({
	    	type:'post',
	    	async:false, 
	    	url:'${pageContext.request.contextPath }/Kanban/deviceBreakdownByDeviceName.do',
	    	data: {"deviceName":sb,"repairTime":date},
	    	success:function(data){
	    		data = data.split('"').join("")
				arr = data.replace('[','').replace(']','').split(',');
	    	}
	    }); 
		return arr;
	}
	function fingwlNum(wl) {
		var num = 0
		//计划量
    	$.ajax({
	    	type:'post',
	    	async:false, 
	    	url:'${pageContext.request.contextPath }/Kanban/lineSideLibraryNumByPaname.do',
	    	data: {"paname":wl},
	    	success:function(data){
	    		num = data;
	    	}
	    }); 
		return num;
	}
	function fingPlanNum(date,product,position) {
		var num = 0
		//计划量
    	$.ajax({
	    	type:'post',
	    	async:false, 
	    	url:'${pageContext.request.contextPath }/Kanban/selectByDate.do',
	    	data: {"format":date,"product":product,"position":position},
	    	success:function(data){
	    		num = data;
	    	}
	    }); 
		return num;
	}
	function fingRealityNum(date,product) {
		var num = 0
		//日产量
	    $.ajax({
	    	type:'post',
	    	async:false, 
	    	url:'${pageContext.request.contextPath }/Kanban/assembleNumByDate.do',
	    	data: {"aremark5":date,"product":product},
	    	success:function(data){
	    		num = data;
	    	}
	    })
	    return num;
	}
</script>
<body>
   
   <table id="table1" style="width: 100%; text-align: center;" border="1px solid #000">
   		<tr>
   			<td width="25%">
   				<img alt="" src="${pageContext.request.contextPath }/img/logo.png" width="70%">
   			</td>
   			<td colspan="2" class="headTd">
   				<p class="font1">组装生产线</p>
   			</td>
   			<td width="25%">
   				<img alt="" src="${pageContext.request.contextPath }/img/logo.png" width="70%">
   			</td>
   			
   		</tr>
   		<tr>
   			<td colspan="4" style="background-color: #000000b3;color: #000;">
   				<a id="myTime"  class="font2"></a>
   				<a id="time1" class="font2"></a>
   				<a id="myWeek"  class="font2"></a>
   			</td>
   		</tr>
   		<tr>
   			<td colspan="2" style="background-color: #06b0de;color: #000;border: 0"> 
   				<p style="color: #ffffff;font-family:微软雅黑;font-size:25px;line-height: 43px;">
   					组装现况
   				</p>
   			</td>
   			<td colspan="2" style="background-color: #00B050;color: #000;border: 0"> 
   				<p style="color: #ffffff;font-family:微软雅黑;font-size:25px;line-height: 43px;">
   					线边库现况
   				</p>
   			</td>
   		</tr>
   		<tr>
   			<td class="font3" colspan="2"> 
   				<table class="showTable" style="width: 100%;">
   					<tr>
   						<td width="30%" class="font3 color3">计划<br>数量</td>
			   			<td class="font3">
			   				<table class="showTable" style="width: 100%;">
			   				 	<tr>
			   				 		<td colspan="2" class="font3" id="planNum">&nbsp;</td>
			   				 	</tr>
			   				 	<tr>
			   						<td width="50%" class="font3" id="planProduct1">&nbsp;</td>
						   			<td class="font3" id="planNum1"></td> 
			   					</tr>
			   					<tr>
			   						<td class="font3" id="planProduct2">&nbsp;</td>
						   			<td class="font3" id="planNum2"></td> 
			   					</tr>
			   					<tr>
			   						<td class="font3" id="planProduct3">&nbsp;</td>
						   			<td class="font3" id="planNum3"></td> 
			   					</tr>
			   					<tr>
			   						<td class="font3" id="planProduct4">&nbsp;</td>
						   			<td class="font3" id="planNum4"></td> 
			   					</tr>
			   				 </table>
			   			</td> 
   					</tr>
   					
   					<tr>
			   			<td class="font3 color3">完成<br>数量</td>
			   			<td class="font3">
			   				<table class="showTable" style="width: 100%;">
			   				 	<tr>
			   				 		<td colspan="2" class="font3" id="realityNum">&nbsp;</td>
			   				 	</tr>
			   				 	<tr>
			   						<td width="50%" class="font3" id="realityProduct1">&nbsp;</td>
						   			<td class="font3" id="realityNum1"></td> 
			   					</tr>
			   					<tr>
			   						<td class="font3" id="realityProduct2">&nbsp;</td>
						   			<td class="font3" id="realityNum2"></td> 
			   					</tr>
			   					<tr>
			   						<td class="font3" id="realityProduct3">&nbsp;</td>
						   			<td class="font3" id="realityNum3"></td> 
			   					</tr>
			   					<tr>
			   						<td class="font3" id="realityProduct4">&nbsp;</td>
						   			<td class="font3" id="realityNum4"></td> 
			   					</tr>
			   				</table>
			   			</td>
   					</tr>
   					
   					<tr>
   						<td class="font3 color3">设备<br>运行</td>
			   			<td class="font3">
			   				 <table class="showTable" style="width: 100%;">
			   				 	<tr>
			   						<td width="50%" class="font3" id="sb1">&nbsp;</td>
						   			<td class="font3" id="bxStare1"></td> 
			   					</tr>
			   					<tr>
			   						<td class="font3" id="sb2">&nbsp;</td>
						   			<td class="font3" id="bxStare2"></td> 
			   					</tr>
			   					<tr>
			   						<td class="font3" id="sb3">&nbsp;</td>
						   			<td class="font3" id="bxStare3"></td> 
			   					</tr>
			   					<tr>
			   						<td class="font3" id="sb4">&nbsp;</td>
						   			<td class="font3" id="bxStare4"></td> 
			   					</tr>
			   				 </table>
			   			</td> 
   					</tr>
   					<tr>
   						<td class="font3 color3">报修<br>次数</td>
			   			<td class="font3">
			   				 <table class="showTable" style="width: 100%;">
			   				 	<tr>
			   						<td width="50%" class="font3" id="sbN1">&nbsp;</td>
						   			<td class="font3" id="bxNum1"></td> 
			   					</tr>
			   					<tr>
			   						<td class="font3" id="sbN2">&nbsp;</td>
						   			<td class="font3" id="bxNum2"></td> 
			   					</tr>
			   					<tr>
			   						<td class="font3" id="sbN3">&nbsp;</td>
						   			<td class="font3" id="bxNum3"></td> 
			   					</tr>
			   					<tr>
			   						<td class="font3" id="sbN4">&nbsp;</td>
						   			<td class="font3" id="bxNum4"></td> 
			   					</tr>
			   				 </table>
			   			</td> 
   					</tr>
   				</table>
   			</td>
   			<td class="font4" colspan="2"> 
   				<table class="showTable" style="width: 100%;">
   					<tr>
   						<td width="30%" class="font4 color4" id="wl1">&nbsp;</td>
			   			<td class="font4" id="wlNum1"></td> 
   					</tr>
   					<tr>
			   			<td class="font4 color4" id="wl2">&nbsp;</td>
			   			<td class="font4" id="wlNum2"></td>
   					</tr>
   					<tr>
			   			<td class="font4 color4" id="wl3">&nbsp;</td>
			   			<td class="font4" id="wlNum3"></td>
   					</tr>
   					<tr>
			   			<td class="font4 color4" id="wl4">&nbsp;</td>
			   			<td class="font4" id="wlNum4"></td>
   					</tr>
   					<tr>
			   			<td class="font4 color4" id="wl5">&nbsp;</td>
			   			<td class="font4" id="wlNum5"></td>
   					</tr>
   				</table>
   			</td>
   		</tr>
   </table>
</body>
</html>